package appconfig

import (
	"github.com/spf13/viper"
	"github.com/zeromicro/go-zero/core/logx"
)

type AppConfig struct {
	MysqlConfig
	RedisConfig
	SendSms
	QiYunYun
}
type MysqlConfig struct {
	Host     string
	Post     int
	User     string
	Password string
	Database string
}
type RedisConfig struct {
	Addr     string
	Password string
	DB       int
}
type SendSms struct {
	AccessKeyId     string
	AccessKeySecret string
	Config          string
}
type QiYunYun struct {
	AccessKey string
	SecretKey string
}

var AppCon AppConfig

func Init() {
	viper.SetConfigFile("appconfig/dev.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&AppCon)
	logx.Info("动态数据连接成功", AppCon)
}
